﻿using MediatR;
using UserLicense.Applicationes.Command;
using UserModels;
using UserModels.DTO;
using UserRepositorys.Intface;

namespace UserLicense.Applicationes.CommandHandler
{
    public class UserListCommandHandler : IRequestHandler<UserListCommand, List<UserDTO>>
    {
        private readonly IUserRepository userRepository;
        public UserListCommandHandler(IUserRepository userRepository)
        {
            this.userRepository = userRepository;
        }

        /// <summary>
        /// 显示所有用户信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public  Task< List<UserDTO>> Handle(UserListCommand request, CancellationToken cancellationToken)
        {
            return userRepository.GetAllUsers();
        }
    }
}
